package org.dtrd.modules.doctor.entity.bean;

import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.DateUtils;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.doctor.entity.po.DtrdEntRdOutpatient;

/**
 * <p>
 * 
 * </p>
 *
 * @author QR
 * @since 2021-12-01 14:09:15
 */
@Getter
@Setter
@ApiModel(value = "门诊信息数据传输对象")
public class OutpatientInfo {

    @ApiModelProperty("医生id")
    private Integer doctorId;

    @ApiModelProperty("门诊日期")
    private String outpatientDate;

    @ApiModelProperty("星期")
    private String weekDay;

    @ApiModelProperty("1-可预约, 0-不可预约")
    private Integer morningStatus;

    @ApiModelProperty("1-可预约, 0-不可预约")
    private Integer afternoonStatus;

    @ApiModelProperty("服务内容")
    private String serviceContent;



    public OutpatientInfo parseFromPo(DtrdEntRdOutpatient po) {
        doctorId = po.getDoctorId();
        outpatientDate = DateUtils.formatDate(po.getOutpatientDate(), DateUtils.date_sdf.get().toPattern());
        morningStatus = po.getMorningStatus();
        afternoonStatus = po.getAfternoonStatus();
        serviceContent = po.getServiceContent();
        int weekDayNum = DateUtil.dayOfWeek(po.getOutpatientDate()) - 1;
        Constant.WeekDay weekDay = Constant.WeekDay.valueOf(weekDayNum);
        assert weekDay != null;
        this.weekDay = weekDay.getName();
        return this;
    }


}
